#!/usr/local/bin/python3
# -*- coding: utf-8 -*-

"""
@File    : chart_test.py
@Author  : Link
@Time    : 2022/6/3 12:04
@Mark    : 测试文学
"""

import pyqtgraph as pg

from chart_core.chart_pyqtgraph.histogram import HistogramChart
from chart_core.chart_pyqtgraph.trans_bar import TransBarChart
from chart_core.chart_pyqtgraph.trans_scatter import TransScatterChart
from chart_core.chart_pyqtgraph.visual_map import VisualMapChart
from workspace_core.li import DfCore

pg.setConfigOptions(antialias=True)  # pg全局变量设置函数，antialias=True开启曲线抗锯齿
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')

app = pg.mkQApp()
li = DfCore()
li.read_by_obj('distribution')
li.calculation_cpk()
li.limit = 0
li.rig = 5

# bar = TransBarChart()
# bar.set_bins(50)
# bar.set_li(li)
# bar.set_data(key='101:OS')
# bar.set_range_self()
# bar.set_front_df_chart()
# bar.set_line_self()
# bar.pw_show()

# scatter = TransScatterChart()
# scatter.set_li(li)
# scatter.set_data(key='101:OS')
# scatter.set_front_df_chart()
# scatter.set_line_self()
# scatter.pw_show()

# histogram = HistogramChart()
# histogram.set_li(li)
# histogram.set_data(key='23:I_VDD')
# histogram.set_front_df_chart()
# histogram.set_line_self()
# histogram.pw_show()

visual = VisualMapChart()
visual.set_li(li)
visual.set_data(key='23:I_VDD')
visual.init_coord()
visual.set_chart_df_chart()
visual.pw_show()

if __name__ == '__main__':
    pg.exec()
